// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'

Vue.config.productionTip = false
Vue.prototype.axios = axios;
/* eslint-disable no-new */



router.beforeEach((to, from, next) => {
  // to  从哪里来
  // from  要去哪里
  // next()  放行    next('/login)  强制你去/login
  if (to.path == '/login') {
    next();
  }
  let auth = localStorage.getItem('auth');
  if (!auth) {
    next('/login')
  } else {
    next();
  }

  // if (to.path == '/login') next();
  // let auth = localStorage.getItem('auth');
  // if (!auth) next('/login');
  // next();

})



new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
